import datetime
from celery import task, Task
from celery import shared_task
from stocksys.sys_tasks.logic_function import DjangoTask
import stocksys.sys_tasks.concept_data
import stocksys.sys_tasks.fund_data
import stocksys.sys_tasks.industry_data
import stocksys.sys_tasks.market_index_data
import stocksys.sys_tasks.stock_data
import stocksys.sys_tasks.alert_system
import stocksys.sys_tasks.update_tasks
import time

@shared_task(bind=True)
def task_debug():
    time.sleep(100000)
    print("sleep done")
    return 0

def get_task_status(func, task_id):
    task = func.AsyncResult(task_id)
    status = task.state
    progress = 0
    # 这里就是在查看进度
    if status == u'SUCCESS':
        progress = 100
    elif status == u'FAILURE':
        progress = 0
    elif status == 'PROGRESS':
        progress = task.info['progress']
    return {'status': status, 'progress': progress}













